<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //字符串的不可变性
        function reverse(str)
        {
            let arr = str.split('');
            let left = 0;
            let right = arr.length-1;
            while(left<right)
            {
                let temp = arr[left];
                arr[left] = arr[right];
                arr[right] = temp;
                left++;
                right--;
            }

            return arr.join('');
        }
        let str  = "123456890";
        rstr = reverse(str);
        console.log(rstr);
    </script>
</body>
</html>